#pragma once

#include <bofcl_eclic_r.h>

// ECLIC中clicinfo寄存器定义
typedef struct {
	u32_s NUM_INTERRUPT : 13;
	u32_s VERSION : 8;
	u32_s CLICINTCTLBITS : 4;
	u32_s : 7;
} eclic_clicinfo_s;

_Static_assert(sizeof(eclic_clicinfo_s) == 4,
	       "Struct eclic_clicinfo_s defined error!");

static inline eclic_clicinfo_s eclic_rreg_clicinfo_s_by_q(u32_s eclic_q) {
	union {
		eclic_clicinfo_s c;
		u32_s u;
	} cu = {
		.u = eclic_rreg_by_q(eclic_q, ECLIC_CLICINFO_R),
	};
	return cu.c;
}
